/**
* 
* ====================================================================
*
* @author apov <apov@ymail.com>
*/ 
#pragma once

#include <BaseDefine.h>

class DBSessionManager;
class DBSession;
class DBSessionProxy{
public:
	enum{
		DEF_NO_CONNECTION_ERROR=		-10000,
		DEF_QUERY_ERROR=				-10001,
	};

	DBSession* get( char* name = 0 );
	void release();

	DBSessionProxy( const char* name );
	virtual ~DBSessionProxy();

protected:
	void ProcessError( const char* msg, int line );

private:
	void select_mgr( char* name );

	DBSessionManager* mgr_;
	DBSession* session_;

	std::string name_;
};
